<?php
namespace sixteen;

class registry
{
	static public $store = array();
	
	static private $thisInstance = null;
	
	function __construct(){}
	
	static public function instance()
	{
		return self::getInstance();
	}
	
	static public function getInstance()
	{
		if(self::$thisInstance==null)
		{
			self::$thisInstance = new registry();
		}
		return self::$thisInstance;
	}
	
	static public function __set($label, $item)
	{
		if(!isset(self::$store[$label]))
		{
			self::$store[$label] = $item;
			return true;
		}
		else
		{
			return false;
		}
	}
	
	static public function __get($label)
	{
		return self::$store[$label];
	}
	
	static public function __unset($label)
	{
		if(isset(self::$store[$label]))
		{
			unset(self::$store[$label]);
			return true;
		}
		else
		{
			return false;
		}
	}
	
	static public function __isset($label)
	{
		if(isset(self::$store[$label]))
		{
			return true;
		}
		else
		{
			return false;
		}
	}
}
?>